package com.grf.hadoop.practice;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;
import java.io.IOException;

public class HttpMapper extends Mapper<LongWritable, Text, HttpBean, NullWritable> {
    //1363157986029 15989002119 E8-99-C4-4E-93-E0:CMCC-EASY 120.196.100.99

    private HttpBean k = new HttpBean();

    @Override
    protected void map(LongWritable key, Text value, Context context)
            throws IOException, InterruptedException {
        String line = value.toString();
        String[] fields = line.split(" ");
        k.setId(fields[0]);
        k.setTel(fields[1]);
        k.setMac(fields[2]);
        k.setIp(fields[3]);
        context.write(k, NullWritable.get());
    }

}
